<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>淘票票影城系统</title>
    <link rel="stylesheet" th:href="@{/css/semantic.min.css}">
    <link rel="stylesheet" th:href="@{/css/admin.css}">
    <script type="text/javascript" th:src="@{/js/jquery-3.4.1.js}"></script>
    <script type="text/javascript" th:src="@{/js/semantic.min.js}"></script>
</head>
<body>
<div class="ui top attached  menu">
    <a class="ui item button" id="menu"><i class="sidebar icon"></i>菜单 </a>
    <a th:href="@{/admin/logout}" class="right item"><i class="sign-out icon"></i>退出</a>
</div>
<div class="ui  sidebar inverted vertical menu">
    <div class="item">
        <h4 class="ui blue header">影城管理系统</h4>
    </div>
    <a th:href="@{/admin/index}" class="item">首页</a>
    <a th:href="@{/admin/hall}" class="item">影厅管理</a>
    <a th:href="@{/admin/time}" class="active item">排片管理</a>
    <a th:href="@{/admin/cinema}" class="item">影院管理</a>
    <a th:href="@{/admin/orders}" class="item">订单管理</a>
</div>

<div class="m-container-small m-padded-tb-big">
    <div class="ui container">
        <form id="time-form" th:action="@{/admin/times}"  method="post" class="ui form">
            <div class="two fields">
                <div class="required field">
                    <div class="ui left labeled action input">
                        <label class="ui compact teal basic label">影厅</label>
                        <div class="ui fluid selection dropdown">
                            <input type="hidden" name="hallId">
                            <i class="dropdown icon"></i>
                            <div class="default text">影厅</div>
                            <div class="menu">
                                <div th:each="hall : ${halls}" class="item" data-value="1" th:data-value="${hall.id}"
                                     th:text="${hall.name}">1号厅
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="required field">
                    <div class="ui left labeled action input">
                        <label class="ui compact teal basic label">影片</label>
                        <div class="ui fluid selection dropdown">
                            <input type="hidden" name="filmId">
                            <i class="dropdown icon"></i>
                            <div class="default text">影片</div>
                            <div class="menu">
                                <div th:each="film : ${films}" class="item" data-value="1" th:data-value="${film.id}"
                                     th:text="${film.name}">1号厅
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">日期</label>
                    <input type="text" name="date" placeholder="格式： 2021-06-12">
                </div>
            </div>

            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">时间</label>
                    <input type="text" name="time" placeholder="格式： 10:00:00">
                </div>
            </div>

            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">价格</label>
                    <input type="text" name="price" placeholder="请输入价格">
                </div>
            </div>


            <div class="ui error message"></div>

            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">取消</button>
                <button type="button" id="publish-btn" class="ui teal button">发布</button>
            </div>
        </form>
    </div>
</div>
<script>
    $("#menu").click(function () {
        $(".ui.sidebar")
            .sidebar({
                transition:'slide out'
            })
            .sidebar("toggle");
    });

    $('.ui.dropdown').dropdown({
        on: 'hover'
    });

    $('#publish-btn').click(function () {
        $('#time-form').submit();
    });

    $('.ui.form').form({
        fields: {
            hallId: {
                identifier: 'hallId',
                rules: [{
                    type: 'empty',
                    prompt: '影厅：请选择影厅'
                }]
            },
            filmId: {
                identifier: 'filmId',
                rules: [{
                    type: 'empty',
                    prompt: '影片：请选择影片'
                }]
            },
            date: {
                identifier: 'date',
                rules: [{
                    type: 'empty',
                    prompt: '时间：请输入时间'
                }]
            },
            time: {
                identifier: 'time',
                rules: [{
                    type: 'empty',
                    prompt: '日期：请输入日期'
                }]
            },
            price:{
                identifier: 'price',
                rules: [{
                    type: 'empty',
                    prompt: '价格：请输入价格'
                }]
            }
        }
    })

</script>
</body>
</html>